<template>
  <div>
    <div class="page">
      <div class="oneBox display branding">
        <div class="infoImg" v-if="info && info.exhibit">
          <img :src="info.exhibit.img" alt="" />
        </div>
        <div class="infoContent" v-if="info && info.exhibit">
          <div class="veTitle">{{ info.exhibit.name }}</div>
          <div class="veContent">
            <p>
              <span style="color: rgba(0, 0, 0, 0.6)">开展日期:</span>
              {{ info.exhibit.start_time }}
            </p>
            <p>
              <span style="color: rgba(0, 0, 0, 0.6)">闭幕日期:</span>
              {{ info.exhibit.end_time }}
            </p>
            <p>
              <span style="color: rgba(0, 0, 0, 0.6)">开放时间:</span>
              每日09:00 - 17:00 （09.18 9:00-14:00）
            </p>
            <p v-if="info.exhibit.labs">
              <span style="color: rgba(0, 0, 0, 0.6)">举办场馆:</span>
              {{ info.exhibit.labs.name }}
            </p>
            <p v-if="info.exhibit.labs">
              <span style="color: rgba(0, 0, 0, 0.6)">举办地址:</span>
              {{ info.exhibit.labs.address }}
            </p>
          </div>
          <div class="btns">
            <el-button
              class="btn"
              style="background-color: #3894ff; color: #fff"
              type="primary"
              @click="webClick(info.exhibit.web_exhibit.enroll_url)"
            >
              登记领票
            </el-button>
           
            <el-button class="btn" style="margin-left: 2rem; color: #3894ff" @click="webClick(info.exhibit.web_exhibit.enroll_store_url)">
             展位申请
              </el-button>
          </div>
        </div>
      </div>
      <div class="oneBox">
        <div class="title">
          <div class="english">EXHIBITOR</div>
          <div class="chinese">本届参展商</div>
        </div>
        <div style="margin-top: 2.8125rem">
          <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
            <el-tab-pane label="全部" name="1"> </el-tab-pane>
            <el-tab-pane
              v-for="item in info.store_tags"
              :label="item.tag_name"
              :name="String(item.id)"
              :key="item.id"
            >
            </el-tab-pane>
          </el-tabs>
        </div>
        <div class="exhibitorList">
          <div
            class="exhibitorItem"
            v-for="item in storeExhibitors"
            :key="item.id"
          >
            <img :src="item.store_one.logo" alt="" />
          </div>
        </div>
        <div class="readMore">
          查看更多>>
        </div>
      </div>
      <div class="oneBox branding">
        <div class="title">
          <div class="english">LIVE EVENTS</div>
          <div class="chinese">展会活动</div>
        </div>
        <div class="exhibitorACT">
          <div class="exhibitorItem" v-for="item in 14" :key="item"></div>
        </div>
      </div>
      <div class="oneBox">
        <div class="title">
          <div class="english">DETAILED INFORMATION</div>
          <div class="chinese">详细信息</div>
        </div>
        <div class="exhibitorDesc" v-if="info.exhibit" v-html="info.exhibit.web_exhibit.dec">
        </div>
      </div>
      <div class="pageination">
        <el-pagination
          background
          layout="prev, pager, next"
          :total="1000">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import { getExhibitInfo, getStoreExhibitList } from "@/api/index";
export default {
  data() {
    return {
      activeName: "1",
      storeExhibitors: [],
      info: {},
      exhibit_id: "",
    };
  },
  created() {
    let id = this.$route.query.id;
    this.exhibit_id = id;
    getExhibitInfo({ code: "fb", exhibit_id: id }).then((res) => {
      this.info = res.data;
      
    });
    getStoreExhibitList({ code: "fb", exhibit_id: id }).then((res) => {
      this.storeExhibitors = res.data.data;
      this.storeExhibitors.length = 14;
      console.log(this.storeExhibitors);
    });
  },
  methods: {
    webClick(url) {
       window.open(url, "_blank");
    },
    handleClick(tab) {
      if (tab.$options.propsData.label == "全部") {
        getStoreExhibitList({ code: "fb", exhibit_id: this.exhibit_id }).then(
          (res) => {
            this.storeExhibitors = res.data.data;
            this.storeExhibitors.length = 14;
            console.log(this.storeExhibitors);
          }
        );
      } else {
        getStoreExhibitList({
          code: "fb",
          exhibit_id: this.exhibit_id,
          tags_name: tab.$options.propsData.label,
        }).then((res) => {
          this.storeExhibitors = res.data.data;
          if (res.data.data.length >= 14) {
            this.storeExhibitors.length = 14;
          }
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/styles/_variables.scss";
.title {
  margin: 0;
}
.page {
  width: 100%;
}
.oneBox {

  position: relative;
  .exhibitorList {
    display: grid;
    grid-template-columns: repeat(7, 9.375rem);
    grid-template-rows: repeat(2, 9.375rem);
    grid-gap: 1.25rem 4.0625rem;
    padding: 2.8125rem 0;
    .exhibitorItem {
      width: 100%;
      height: 100%;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  .exhibitorACT{
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 4rem 0;
  }
  .exhibitorDesc{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    p{
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
    ::v-deep p {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    margin: 1rem 0;
  }
  }
}
//简介
.infoImg {
  width: 36rem;
  height: 24.5625rem;
  img {
    width: 100%;
    height: 100%;
  }
}
.infoContent {
  padding-left: 4.5rem;
  flex: 1;
  .veTitle {
    font-size: 1.75rem;
    font-weight: bold;
  }
  .veContent {
    font-size: 1.125rem;
    margin-top: 4.1875rem;
    p {
      margin: 0.5rem 0;
    }
  }
  .btns {
    display: flex;
    margin-top: 2.625rem;
    .btn {
      width: 12.5rem;
      height: 3.3125rem;
      font-size: 1.25rem;
    }
  }
}
.readMore{
  font-size: 0.875rem;
  color: $btn-color;
  position: absolute;
  right: 15rem;
  bottom: 2.8125rem;
  cursor: pointer;
}
::v-deep .el-tabs__item.is-active {
  background: #1b6acc;
  color: #fff;
}
::v-deep .is-top {
  border: none !important;
  display: flex;
  justify-content: center;
}
::v-deep .el-tabs__header {
  margin: 0 !important;
}
::v-deep .el-divider {
  background-color: #000;
}
::v-deep .el-tabs__item {
  padding: 0.5rem 1.25rem !important;
  font-size: 1.125rem;
  margin-right: 1.5rem;
  border-radius: 0.5rem;
  background: #f5f5f5;
  color: $btn-color;
  height: auto;
}
::v-deep .el-tabs__nav-next {
  line-height: 2.625rem;
  font-size: 0.8rem;
}
::v-deep .el-tabs__nav-prev {
  line-height: 2.625rem;
  font-size: 0.8rem;
}
</style>